DESCRIPTION = "Allwinner Tina multimedia binary"
LICENSE = "CC0-1.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/${LICENSE};md5=0ceb3372c9595f0a8067e55da801e4a1"
PV = "1.0"
PR = "r0"
COMPATIBLE_MACHINE = "(^d1*)"

DEPENDS = "                     \
    alsa-lib                    \
    zlib                        \
    glib-2.0                    \
    glib-2.0-native             \
    gstreamer1.0                \
    gstreamer1.0-plugins-base   \
    gstreamer1.0-plugins-bad    \
    "

#   file://usr/lib/gstreamer-1.0/libgstavi.so
#   file://usr/lib/gstreamer-1.0/libgstcoreelements.so
#   file://usr/lib/gstreamer-1.0/libgstcoretracers.so
#   file://usr/lib/gstreamer-1.0/libgstomx.so
#   file://usr/lib/gstreamer-1.0/libgstsunxifbsink.so
#   file://usr/lib/gstreamer-1.0/libgstvideoparsersbad.so

SRC_URI = " \
    file://usr/bin/tplayerdemo \
    file://usr/bin/trecorderdemo \
    file://usr/lib/libadecoder.so \
    file://usr/lib/libaencoder.so \
    file://usr/lib/libaftertreatment.so \
    file://usr/lib/libaw_aacdec.so \
    file://usr/lib/libaw_alacdec.so \
    file://usr/lib/libaw_amrdec.so \
    file://usr/lib/libaw_apedec.so \
    file://usr/lib/libaw_atrcdec.so \
    file://usr/lib/libaw_dsddec.so \
    file://usr/lib/libaw_flacdec.so \
    file://usr/lib/libaw_g729dec.so \
    file://usr/lib/libawh264.so \
    file://usr/lib/libawh265.so \
    file://usr/lib/libawmjpeg.so \
    file://usr/lib/libaw_mp3dec.so \
    file://usr/lib/libawmpeg2.so \
    file://usr/lib/libawmpeg4base.so \
    file://usr/lib/libawmpeg4dx.so \
    file://usr/lib/libawmpeg4h263.so \
    file://usr/lib/libawmpeg4normal.so \
    file://usr/lib/libaw_oggdec.so \
    file://usr/lib/libaw_opusdec.so \
    file://usr/lib/libaw_radec.so \
    file://usr/lib/libawrecorder.so \
    file://usr/lib/libawrpaf.so \
    file://usr/lib/libaw_siprdec.so \
    file://usr/lib/libaw_wavdec.so \
    file://usr/lib/libawwmv3.so \
    file://usr/lib/libcdc_base.so \
    file://usr/lib/libcdx_base.so \
    file://usr/lib/libcdx_common.so \
    file://usr/lib/libcdx_muxer.so \
    file://usr/lib/libcdx_parser.so \
    file://usr/lib/libcdx_playback.so \
    file://usr/lib/libcdx_stream.so \
    file://usr/lib/libcrypto.so.1.1 \
    file://usr/lib/libfbm.so \
    file://usr/lib/libgstframebuffersink.so \
    file://usr/lib/libMemAdapter.so \
    file://usr/lib/libOmxCore.so \
    file://usr/lib/libOmxVdec.so \
    file://usr/lib/libOmxVenc.so \
    file://usr/lib/libsbm.so \
    file://usr/lib/libscaledown.so \
    file://usr/lib/libssl.so.1.1 \
    file://usr/lib/libsubdecoder.so \
    file://usr/lib/libtplayer.so \
    file://usr/lib/libtrecorder.so \
    file://usr/lib/libuapi.so \
    file://usr/lib/libvdecoder.so \
    file://usr/lib/libvenc_base.so \
    file://usr/lib/libvenc_common.so \
    file://usr/lib/libvenc_h264.so \
    file://usr/lib/libvenc_h265.so \
    file://usr/lib/libvenc_jpeg.so \
    file://usr/lib/libvencoder.so \
    file://usr/lib/libVE.so \
    file://usr/lib/libvideoengine.so \
    file://usr/lib/libxplayer.so \
    file://etc/cedarc.conf \
    file://etc/cedarx.conf \
    file://etc/xdg/gstomx.conf \
    "

do_install() {
    install -d ${D}${bindir_native}
    install -d ${D}${libdir_native}
    install -d ${D}${sysconfdir}
#    install -d ${D}${libdir_native}/gstreamer-1.0/
#    install -d ${D}${sysconfdir}/xdg/

    install -m 0755 ${WORKDIR}/usr/bin/tplayerdemo      ${D}${bindir_native}/
    install -m 0755 ${WORKDIR}/usr/bin/trecorderdemo    ${D}${bindir_native}/

    install -m 0755 ${WORKDIR}/usr/lib/*.so             ${D}${libdir_native}

    install -m 0755 ${WORKDIR}/usr/lib/libcrypto.so.1.1     ${D}${libdir_native}/
    install -m 0755 ${WORKDIR}/usr/lib/libssl.so.1.1        ${D}${libdir_native}/

#    install -m 0644 ${WORKDIR}/usr/lib/gstreamer-1.0/* ${D}${libdir_native}/gstreamer-1.0/
#    install -m 0644 ${WORKDIR}/etc/xdg/gstomx.conf ${D}${sysconfdir}/xdg/gstomx.conf

    install -m 0644 ${WORKDIR}/etc/cedarc.conf ${D}${sysconfdir}/cedarc.conf
    install -m 0644 ${WORKDIR}/etc/cedarx.conf ${D}${sysconfdir}/cedarx.conf

#    ln -s ${D}${libdir_native}/ld-linux-riscv64-lp64d.so.1 ${D}${libdir_native}/ld-linux-riscv64xthead-lp64d.so.1

    ln -sr ${D}${libdir}/ld-linux-riscv64-lp64d.so.1 ${D}${libdir}/ld-linux-riscv64xthead-lp64d.so.1
}

FILES:${PN} = "                     \
    ${bindir_native}                \
    ${libdir_native}                \
    ${sysconfdir}                   \
    ${{libdir_native}}/ld-linux-riscv64xthead-lp64d.so.1   \
    "
PACKAGES = "${PN}"

INSANE_SKIP:${PN} += "  \
    dev-so              \
    already-stripped    \
    "
